package sala.commonmovie.rightmenu 
{
	import flash.display.MovieClip;
	import sala.events.RightMenuEvent;
	import sala.model.VideoInfo;
	import gs.TweenLite; 
	
	/**
	 * ...
	 * @author Sun
	 */
	public class RightMenu extends MovieClip
	{
		private var videoInfoArr:Array;
		private var videoItemArr:Array;
		
		private var activeItem: RightMenuItem;
		
		
		public function RightMenu() 
		{
			//this.visible = false; 
			this.alpha = 0; 
			this.addEventListener(RightMenuEvent.RIGHT_MENU_ITEM_CLICKED, rightMenuItemClickedHdl);
		}
		
		private function rightMenuItemClickedHdl(e:RightMenuEvent):void 
		{
			if(activeItem) activeItem.active = false;
			activeItem = RightMenuItem(e.target);
			activeItem.active = true;
		}
		
		public function initRightMenu(vInfoArr:Array): void
		{
			while (this.numChildren)
			{
				this.removeChildAt(0);
			}
			
			videoInfoArr = vInfoArr;
			videoItemArr = [];
			
			var rightItem: RightMenuItem;
			var videoInfo: VideoInfo;
			for (var i:uint = 0; i < videoInfoArr.length; i++)
			{
				rightItem = new RightMenuItem();
				videoInfo = videoInfoArr[i];
				rightItem.updateRightMenuItem(videoInfo);
				rightItem.y = i * 70;
				this.addChild(rightItem);
				videoItemArr.push(rightItem);
			}
		}
		
		public function showThumbs():void
		{
			TweenLite.to(this, 2, { x:825,alpha:1} ); 
			
		}
		
	}

}